using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

namespace DemoVS2022.API.Controllers
{
    // get 查  post 增  put 改(修改整个数据)  delete 删  patch 改(修改部分数据)

    [ApiController]
    [Route("api/[controller]/[action]")]
    public class TestController : ControllerBase
    {
        // 路由规则（有三种方法）
        [HttpGet()]
        public string Get()
        {
            return "TestACE--Get";
        }
        
        [HttpPost]
        public string Post(int i, string name)
        {
            return "TestACE---Post" + i + "--" + name;
        }

        // 自定义路由 -- 路由传参 --- 必须要传入的参数-否则路由无法生效
        [HttpGet("{i}/{name}")]
        public string GetById(int i, string name)
        {
            return "GetById---" + i + "--" + name;
        }

        [HttpPut]
        public string Put()
        {
            return "TestACE---Put";
        }

        [HttpDelete]
        public string Delete()
        {
            return "TestACE---Delete";  
        }
    }
}
